<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport"
	      content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<title>Top 1000<#if category != ''> ${category}</#if> Influencers Leaderboard on Instagram<#if nation != ''> in ${nation}</#if> | GugeeData</title>
	<meta name="description"
	      content="Find real-time top instagram<#if category != ''> ${category}</#if> influencers<#if nation != ''> in ${nation}</#if> to collaborate. | GugeeData">
	<meta name="keywords" content="top instagram influencers, influencer ranking, instagram influencers leaderboard">
	<meta property="og:title" content="Top 1000<#if category != ''> ${category}</#if> Influencers Leaderboard on Instagram<#if nation != ''> in ${nation}</#if> | GugeeData">
	<meta property="og:description"
	      content="Find real-time top instagram<#if category != ''> ${category}</#if> influencers<#if nation != ''> in ${nation}</#if> to collaborate. | GugeeData">
	<meta property="og:type" content="website">
	<meta property="og:url" content="${curUrl}">
	<meta property="og:image" content=" https://seo-imags.s3.us-east-2.amazonaws.com/Logo.png">
	<meta name="twitter:title" content="Top 1000<#if category != ''> ${category}</#if> Influencers Leaderboard on Instagram<#if nation != ''> in ${nation}</#if> | GugeeData">
	<meta name="twitter:description"
	      content="Find real-time top instagram<#if category != ''> ${category}</#if> influencers<#if nation != ''> in ${nation}</#if> to collaborate. | GugeeData">
	<link rel="icon" href="${request.contextPath}/static/img/favicon.ico" type="image/x-icon"/>
	<link rel="shortcut icon" href="${request.contextPath}/static/img/favicon.ico" type="image/x-icon"/>
	<link href="https://fonts.googleapis.com/css2?family=Oswald:wght@500&display=swap" rel="stylesheet">
	<link rel="stylesheet" href="${request.contextPath}/static/plugins/layui/layui.css">
	<link rel="stylesheet" href="${request.contextPath}/static/css/ins/common.css">
	<link rel="stylesheet" href="${request.contextPath}/static/css/ins/rank.css">
    <#include "../../component/facebookPixel.ftl">
</head>
<body>
<#include "../../header_new1.ftl">
<main>
	<section>
		<div class="container">
			<h1>Top 1000 ${category} Influencers Leaderboard on Instagram<#if nation != ''> in ${nation}</#if> </h1>
			<h2>Find real-time top Instagram ${category} influencers<#if nation != ''> in ${nation}</#if> to collaborate.</h2>
			<div class="rank-tab">
				<div class="tab-list">
					<div class="tab-item is-active">Comprehensive Influential Leaderboard</div>
					<div class="tab-item">
						<a href="/instagram/follower-growth">Follower Growth Leaderboard</a>
					</div>
					<div class="tab-item">
						<a href="/instagram/rank-commercial-partner">Commercial Partner Leaderboard</a>
					</div>
				</div>
			</div>
			<div class="gd-select rank-tab-select">
				<div class="gd-select-title">
					<div class="label">Comprehensive Influential Leaderboard</div>
					<i class="iconfont icondown1"></i>
				</div>
				<div class="gd-select-wrap">
					<ul>
						<li class="gd-option is-active">Comprehensive Influential Leaderboard</li>
						<li class="gd-option" onclick="toGrowth()">
							Follower Growth Leaderboard
						</li>
						<li class="gd-option" onclick="toParter()">
							Commercial Partner Leaderboard
						</li>
					</ul>
				</div>
			</div>
		</div>
	</section>
	<section>
		<div class="container is-pc">
			<div class="export-row">
				<span class="date-tips">${updateTimeStr}</span>
				<button class="gd-btn btn-info" onclick="exportRank()">Export</button>
				<#if updateTime != 0>
                    <#setting datetime_format="MM-yyyy"/>
					<div class="flex-right">Data updated：${(updateTime)?number_to_datetime}</div>
				<#else>
					<div class="flex-right">Data updated：-</div>
				</#if>
			</div>
			<div class="search-row">
				<div class="search-item">
					<div class="label">Categories :</div>
					<div class="search-wrap">
						<ul id="categoryList">
							<li>All</li>
						</ul>
					</div>
				</div>
				<div class="search-item">
					<div class="label">Country:</div>
					<div class="search-wrap">
						<ul id="countryList">
							<li>All</li>
						</ul>
					</div>
				</div>
			</div>
			<div class="tab-wrap">
				<table class="ins-table">
					<thead>
					<tr>
						<th align="left">Rank</th>
						<th align="left">Influencer</th>
						<th>Followers</th>
<#--						<th>30-Day Growth</th>-->
						<th>Avg Likes</th>
						<th>Avg ER</th>
						<th>Action</th>
					</tr>
					</thead>
					<#if listData.list?size gt 0>
						<tbody>
                        <#list listData.list as item>
							<tr>
								<td class="td-inx">
									<div class="td-inx__inner">
										<div class="tb-inx">${item.rank}</div>
										<div class="inx-status">
                                            <#if item.rankGrowCount lt 0>
												<span class="rank-down">↓ ${item.rankGrowCount*-1}</span>
                                            <#elseif item.rankGrowCount == 0>
												-
                                            <#else>
                                                <#if item.rankGrowCount gt 1000>
													<img class="rank-new" src="/static/img/ins/NEW.svg" alt="new"/>
                                                <#else>
													<span class="rank-up">↑ ${item.rankGrowCount}</span>
                                                </#if>
                                            </#if>
										</div>
									</div>
								</td>
								<td class="tb-user">
									<div class="avatar">
                                        <#assign picUrl=myController.getNoExpiredImage(item.picUrl, 0, 0)>
										<img src="${picUrl}" alt="${item.fullName!''}">
                                        <#if item.isVerified?? && item.isVerified == true>
											<img class="avatar__affix" src="/static/img/ins/Authentication.png" alt=""/>
                                        </#if>
									</div>
									<div class="label">
										<div class="title">
                                            ${item.username!''}
                                            <#if item.secondCategory??>
												<div class="limit-tx">${item.secondCategory}</div>
											<#elseif item.categoryName??>
												<div class="limit-tx">${item.categoryName}</div>
											</#if>
										</div>
										<div class="sub-title">${item.fullName!''}</div>
									</div>
								</td>
                                <#if item.followerCount??>
                                    <#assign followerCount=myController.getNumber(item.followerCount)>
									<td>${followerCount}</td>
                                <#else>
									<td>0</td>
                                </#if>
                                <#--<#if item.followerGrow??>
									<#assign followerGrow=myController.getNumber(item.followerGrow)>
									<td>${followerGrow}</td>
								<#else>
									<td>0</td>
								</#if>-->
                                <#if item.avgLike??>
                                    <#assign avgLike=myController.getNumber(item.avgLike)>
									<td>${avgLike}</td>
                                <#else>
									<td>0</td>
                                </#if>
                                <#if item.avgEr??>
                                    <#assign avgEr=myController.getNumber(item.avgEr * 100)>
									<td>${avgEr}%</td>
                                <#else>
									<td>0%</td>
                                </#if>
								<td>
									<div class="td-action">
										<div class="gd-popover" content="Analyze">
											<div class="blue">
												<a href="/instagram/influencer/${item.username}" target="_blank">
													<i class="iconfont iconxiangqing"></i>
												</a>
											</div>
										</div>
									</div>
								</td>
							</tr>
                        </#list>
						</tbody>
                    <#else>
						<tbody>
						<tr>
							<td colspan="7">
								<div class="no-data">
									<img width="131" height="131" src="/static/img/ins/noData.png" alt="">
									<div class="title">No related data available</div>
								</div>
							</td>
						</tr>
						</tbody>
                    </#if>
				</table>
			</div>
			<div class="pagination" id="pagination"></div>
		</div>
		<div class="container is-mobile">
			<div class="sort-list">
				<div class="sort-item" onclick="showFilter(0)">
					<#if category?? && category != ''>
						${category}
					<#else>
						Categories
					</#if>
					<i class="iconfont icondown1"></i>
				</div>
				<#--<div class="sort-item">
					Nov 8 - Nov 9, 2020
					<i class="iconfont icondown1"></i>
				</div>-->
				<div class="sort-item" onclick="showFilter(1)">
					<#if nation?? && nation != ''>
						${nation}
					<#else>
						Country
					</#if>
					<i class="iconfont icondown1"></i>
				</div>
			</div>
			<div class="filter-wrap" onclick="hideFilter()">
				<div class="filter-wrap__inner">
					<div class="sort-list">
						<div class="sort-item" onclick="showFilter(0)">
                            <#if category?? && category != ''>
								${category}
							<#else>
								Categories
							</#if>
							<i class="iconfont icondown1"></i>
						</div>
                        <#--<div class="sort-item">
							Nov 8 - Nov 9, 2020
							<i class="iconfont icondown1"></i>
						</div>-->
						<div class="sort-item" onclick="showFilter(1)">
                            <#if nation?? && nation != ''>
								${nation}
							<#else>
								Country
							</#if>
							<i class="iconfont icondown1"></i>
						</div>
					</div>
					<ul id="sortCategory" style="display: none"></ul>
					<ul id="sortCountry" style="display: none"></ul>
				</div>
			</div>
			<div class="gd-mobile-list">
				<div class="gd-mobile-list__wrap">
					<#if listData.list?size gt 0>
                        <#list listData.list as item>
							<a href="/instagram/influencer/${item.username}">
								<div class="user-item">
									<div class="user-info">
										<div class="avatar">
                                            <#assign picUrl=myController.getNoExpiredImage(item.picUrl, 0, 0)>
											<img class="head" src="${picUrl}" alt="${item.fullName}">
                                            <#if item.isVerified == true>
												<img class="icon" width="16" height="16"
												     src="${request.contextPath}/static/img/ins/Authentication.png"
												     srcset="${request.contextPath}/static/img/ins/Authentication@2x.png 2x" alt="">
                                            </#if>
										</div>
										<div class="user-title">
											<div class="top">
												<div class="nickname">${item.username}</div>
												<#--<svg title="${item.nation}" class="icon icon-country" aria-hidden="true">
													<use xlink:href="#icon_${item.nation}"></use>
												</svg>-->
												<#if item.secondCategory??>
													<div class="category">${item.secondCategory}</div>
												<#elseif item.categoryName??>
													<div class="limit-tx">${item.categoryName}</div>
												</#if>
											</div>
											<div class="bottom">
                                                ${item.fullName}
											</div>
										</div>
										<div class="user-rank">
                                            ${item.rank}
											<div class="user-rank-change">
                                                <#if item.rankGrowCount lt 0>
													<span class="rank-down">↓ ${item.rankGrowCount*-1}</span>
                                                <#elseif item.rankGrowCount == 0>
													-
                                                <#else>
                                                    <#if item.rankGrowCount gt 1000>
	                                                    <img class="rank-new" src="/static/img/ins/NEW.svg" alt="new" />
                                                    <#else>
														<span class="rank-up">↑ ${item.rankGrowCount}</span>
                                                    </#if>
                                                </#if>
											</div>
										</div>
									</div>
									<div class="user-data">
										<div class="data-item">
											<div class="label">Followers</div>
                                            <#if item.followerCount??>
                                                <#assign followerCount=myController.getNumber(item.followerCount)>
												<div class="num">${followerCount}</div>
                                            <#else>
												<div class="num">0</div>
                                            </#if>
										</div>
										<#--<div class="data-item">
											<div class="label">Followers Growth</div>
                                            <#if item.followerGrow??>
                                                <#assign followerGrow=myController.getNumber(item.followerGrow)>
												<div class="num">${followerGrow}</div>
                                            <#else>
												<div class="num">0</div>
                                            </#if>
										</div>-->
										<div class="data-item">
											<div class="label">Avg Likes</div>
                                            <#if item.avgLike??>
                                                <#assign avgLike=myController.getNumber(item.avgLike)>
												<div class="num">${avgLike}</div>
                                            <#else>
												<div class="num">0</div>
                                            </#if>
										</div>
										<div class="data-item">
											<div class="label">Avg ER</div>
                                            <#if item.avgEr??>
                                                <#assign avgEr=myController.getNumber(item.avgEr * 100)>
												<div class="num">${avgEr}%</div>
                                            <#else>
												<div>0%</div>
                                            </#if>
										</div>
									</div>
								</div>
							</a>
                        </#list>
					<#else>
						<div class="no-data">
							<img width="131" height="131" src="/static/img/ins/noData.png"
						                          alt="no data img"
						                          srcset="/static/img/ins/noData@2x.png 2x, /static/img/ins/noData@3x.png 3x">
							<div class="title">No related data available</div>
						</div>
                    </#if>
				</div>
				<div class="gd-mobile-list__footer">
                    <#if login != false>
						<#if listData.list?size gt 0>
							<#if listData.list?size lt 10>
								<span class="list-footer-tx">You have reached the end.</span>
							<#else>
								<div class="rotate"><i class="iconfont icongengxin"></i></div>
								<span class="list-footer-tx" style="display: none;">You have reached the end.</span>
							</#if>
						</#if>
                    <#else>
						<a href="#" class="link-login">
							View More
						</a>
                    </#if>
				</div>
			</div>
		</div>
	</section>
</main>
<#if isMobile == false>
    <#include "../../footer_new.ftl">
	<script src="${request.contextPath}/static/plugins/layui/layui.js" charset="utf-8"></script>
</#if>
<script src="${request.contextPath}/static/js/gd-ui/select/index.js"></script>
<script src="${request.contextPath}/static/js/nums.js"></script>
<script src="${request.contextPath}/static/js/scroll.js"></script>
<script src="${request.contextPath}/static/js/list/common.js"></script>
<script>
    initRank()
    const params = {
        pageSize: 10,
        page: 1,
        categoryName: '${category}'
    }
    let nationName = '${nation}'
    <#if isMobile == true>
    let scrollTimer
    let hasData = true
    window.addEventListener('scroll', () => {
        if (!hasData) {
            return
        }
        if (parseInt((getScrollTop() + getWindowHeight() + 200)) >= getScrollHeight()) {
            if (scrollTimer) {
                clearTimeout(scrollTimer)
            }
            scrollTimer = setTimeout(() => {
                const list_len = document.querySelectorAll('.gd-mobile-list__wrap > a').length
                if (list_len >= params.page * 10) {
                    params.page++
                    getMobileRankList()
                }
            }, 500)
        } else {
            if (scrollTimer) {
                clearTimeout(scrollTimer)
            }
        }
    })
	<#else>
		initPagination()
		function initPagination() {
			layui.use('laypage', function () {
				let laypage = layui.laypage;
				//执行一个laypage实例
				laypage.render({
					elem: 'pagination', //注意，这里的 test1 是 ID，不用加 # 号
					count: ${listData.totalRow?c}, //数据总数，从服务端得到
					prev: '<i class="iconfont iconicon_previous"></i>',
					next: '<i class="iconfont iconarrowright"></i>',
					jump: (obj, first) => {
						if (!first) {
							<#if login == false>
							toLogin()
							return false
							</#if>
							params.page = obj.curr
							getRankList()
						}
					}
				})
			})
		}
    </#if>

    function initRank() {
        initOption()
    }
    document.querySelector('.filter-wrap__inner').addEventListener('click', e => {
        e.stopPropagation()
    })
    function showFilter (type) {
        document.body.style.overflow = 'hidden'
        document.querySelector('.filter-wrap').show()
	    const sortCountry = document.getElementById('sortCountry')
        const sortCategory = document.getElementById('sortCategory')
		if(type === 0) {
            sortCategory.show()
            sortCountry.hide()
		} else {
            sortCategory.hide()
            sortCountry.show()
		}
    }
    function hideFilter() {
        document.body.style.overflow = 'auto'
        document.querySelector('.filter-wrap').hide()
    }
    function toGrowth() {
        window.location.href='/instagram/follower-growth'
    }
    function toParter() {
        window.location.href='/instagram/rank-commercial-partner'
    }
    function getRankList() {
        if(params['categoryName'] === '') {
            params['categoryName'] = undefined
        }
		if(params['nation'] === '') {
			params['nation'] = undefined
		}
        let url = getEncodeUrl('/ins/fl/rank', params)
	    let tableBody = document.querySelector('.ins-table tbody')
	    tableBody.showLoading()

        getList(tableBody, url, list => {
            let str = ''
            list.forEach(item => {
                str += '<tr>' +
                    '<td class="td-inx">' +
                    '<div class="td-inx__inner">' +
                    '<div class="tb-inx">' + item.rank + '</div>' +
                    '<div class="inx-status">'
                if(item.rankGrowCount < 0) {
                    str += '<span class="rank-down">↓ ' + (item.rankGrowCount*-1) + '</span>'
                } else if(item.rankGrowCount === 0) {
                    str += '-'
                } else {
                    if(item.rankGrowCount > 1000) {
                        str += '<img class="rank-new" src="/static/img/ins/NEW.svg" alt="new" />'
                    } else {
                        str += '<span class="rank-up">↑ ' + item.rankGrowCount + '</span>'
                    }
                }
                str += '</div>' +
                    '</div>' +
                    '</td>' +
                    '<td class="tb-user">' +
                    '<div class="avatar">' +
                    '<img src="' + getImage(item.picUrl,IMAGE_TYPE.BLOGGER, IMAGE_SIZE.SMALL) + '" alt="' + item.fullName + '">'
                if(item.isVerified) {
                    str += '<img class="avatar__affix" src="/static/img/ins/Authentication.png" alt="" />'
                }
                str += '</div>' +
                    '<div class="label">' +
                    '<div class="title">' + item.username
                if(item.secondCategory) {
                    str += '<div class="limit-tx">' + item.secondCategory + '</div>'
                } else if (item.categoryName) {
					str += '<div class="limit-tx">' + item.categoryName + '</div>'
				}
                str += '</div>' +
                    '<div class="sub-title">' + item.fullName +'</div>' +
                    '</div>' +
                    '</td>' +
                    ' <td>' + numFormat(+item.followerCount) + '</td>' +
                    // ' <td>' + numFormat(+item.followerGrow) + '</td>'+
                    '<td>' + numFormat(+item.avgLike) + '</td>' +
                    '<td>' + numFormat(+item.avgEr * 100) + '%</td>' +
                    '<td>' +
                    '<div class="td-action">' +
                    '<div class="gd-popover" content="Analyze">' +
                    '<div class="blue">' +
                    '<a href="/instagram/influencer/' + item.username + '" target="_blank">' +
                    '<i class="iconfont iconxiangqing"></i>' +
                    '</a>' +
                    '</div>' +
                    '</div>' +
                    '</div>' +
                    '</td>' +
                    '</tr>'
            })
            return str
        })
    }

    function getMobileRankList() {
		if(params['categoryName'] === 'All') {
			params['categoryName'] = undefined
		}
		if(params['nation'] === 'All') {
			params['nation'] = undefined
		}
        let url = getEncodeUrl('/ins/fl/rank', params)
        const wrap = document.querySelector('.gd-mobile-list__wrap')
        wrap.showLoading()

        getList(wrap, url, list => {
            let str = ''
            list.forEach(item => {
                str += '<a href="/instagram/influencer/' + item.username + '">' +
                    '<div class="user-item">' +
                    '<div class="user-info">' +
                    '<div class="avatar">' +
                    '<img class="head" src="' + getImage(item.picUrl,IMAGE_TYPE.BLOGGER, IMAGE_SIZE.SMALL) + '" alt="' + item.fullName + '">'
                if(item.isVerified) {
                    str += '<img class="icon" width="16" height="16" src="${request.contextPath}/static/img/ins/Authentication.png" srcset="${request.contextPath}/static/img/ins/Authentication@2x.png 2x" alt="">'
                }
                str += '</div>' +
                    '<div class="user-title">' +
                    '<div class="top">' +
                    '<div class="nickname">' + item.username + '</div>'
                // '<svg title="' + item.nation + '" class="icon icon-country" aria-hidden="true">' +
                // '<use xlink:href="#icon_' + item.nation + '"></use>' +
                // '</svg>' +
                if(item.secondCategory) {
                    str += '<div class="category">' + item.secondCategory + '</div>'
                } else if (item.categoryName) {
					str += '<div class="category">' + item.categoryName + '</div>'
				}
                str += '</div>' +
                    '<div class="bottom">' + item.fullName +
                    '</div>' +
                    '</div>' +
                    '<div class="user-rank">' + item.rank +
                    '<div class="user-rank-change">'
                if (item.rankGrowCount < 0) {
                    str += '<span class="rank-down">↓ ' + item.rankGrowCount * -1 + '</span>'
                } else if (item.rankGrowCount === 0) {
                    str += '-'
                } else {
                    if (item.rankGrowCount > 1000) {
                        str += '<img class="rank-new" src="/static/img/ins/NEW.svg" alt="new" />'
                    } else {
                        str += '<span class="rank-up">↑ ' + item.rankGrowCount + '</span>'
                    }
                }
                str += '</div>' +
                    '</div>' +
                    '</div>' +
                    '<div class="user-data">' +
                    '<div class="data-item">' +
                    '<div class="label">Followers</div>' +
                    '<div class="num">' + numFormat(+item.followerCount) +'</div>' +
                    '</div>' +
                    /*'<div class="data-item">' +
					'<div class="label">30-Day Growth</div>' +
					'<div class="num">' + numFormat(+item.followerGrow) + '</div>' +
					'</div>' +*/
                    '<div class="data-item">' +
                    '<div class="label">Avg Likes</div>' +
                    '<div class="num">' + numFormat(item.avgLike) + '</div>' +
                    '</div>' +
                    '<div class="data-item">' +
                    '<div class="label">Avg ER</div>' +
                    '<div class="num">' + numFormat(+item.avgEr) + '%</div>' +
                    '</div>' +
                    '</div>' +
                    '</div>' +
                    '</a>'
            })
            return str
        })
    }

    function exportRank() {
        <#if login == false>
        toLogin()
        return false
        </#if>
		visitRecord(22)
        let url = getEncodeUrl('/ins/fl/export', params)
        window.open(url)
    }

    function initOption() {
        Promise.all([getCategory(), getCountry()]).then(res => {
            let str = ''
            if (res[0].Code === 200) {
                const categoryList = document.getElementById('categoryList')
                if (params.categoryName === '') {
                    str = '<li class="is-active" value="">All</li>'
                    res[0].Data.forEach(item => {
                        str += '<li value="' + item.overallCategory + '">' + item.overallCategory + '</li>'
                    })
                } else {
                    str = '<li value="">All</li>'
                    res[0].Data.forEach(item => {
                        if(params.categoryName === item.overallCategory) {
                            str += '<li value="' + item.overallCategory + '" class="is-active">' + item.overallCategory + '</li>'
                        } else {
                            str += '<li value="' + item.overallCategory + '">' + item.overallCategory + '</li>'
                        }
                    })
                }
                categoryList.innerHTML = str

                const sortCategory = document.getElementById('sortCategory')
                if (params.categoryName === '') {
                    str = '<li class="is-active" value="">All<div class="right"> <i class="iconfont iconzhichi"></i></div></li>'
                    res[0].Data.forEach(item => {
                        str += '<li value="' + item.overallCategory + '">' + item.overallCategory + '</li>'
                    })
                } else {
                    str = '<li value="">All</li>'
                    res[0].Data.forEach(item => {
                        if(params.categoryName === item.overallCategory) {
                            str += '<li value="' + item.overallCategory + '" class="is-active">' + item.overallCategory + '<div class="right"> <i class="iconfont iconzhichi"></i></div></li>'
                        } else {
                            str += '<li value="' + item.overallCategory + '">' + item.overallCategory + '</li>'
                        }
                    })
                }
                sortCategory.innerHTML = str
            }
            if (res[1].Code === 200) {
                const countryList = document.getElementById('countryList')
                if(nationName === '') {
                    str = '<li class="is-active" value="">All</li>'
                    res[1].Data.forEach(item => {
                        str += '<li value="' + item.code + '">' + item.name + '</li>'
                    })
                } else {
                    str = '<li value="">All</li>'
                    res[1].Data.forEach(item => {
                        if(nationName === item.name) {
                            params.nation = item.code
                            str += '<li value="' + item.code + '" class="is-active">' + item.name + '</li>'
                        } else {
                            str += '<li value="' + item.code + '">' + item.name + '</li>'
                        }
                    })
                }
                countryList.innerHTML = str

                const sortCountry = document.getElementById('sortCountry')
                if(nationName === '') {
                    str = '<li class="is-active" value="">All<div class="right"> <i class="iconfont iconzhichi"></i></div></li>'
                    res[1].Data.forEach(item => {
                        str += '<li value="' + item.code + '">' + item.name + '</li>'
                    })
                } else {
                    str = '<li value="">All</li>'
                    res[1].Data.forEach(item => {
                        if(nationName === item.name) {
                            params.nation = item.code
                            str += '<li value="' + item.code + '" class="is-active">' + item.name + '<div class="right"> <i class="iconfont iconzhichi"></i></div></li>'
                        } else {
                            str += '<li value="' + item.code + '">' + item.name + '</li>'
                        }
                    })
                }
                sortCountry.innerHTML = str
            }
            document.querySelectorAll('.search-wrap li').forEach(item => {
                item.addEventListener('click', e => {
                    if(!e.target.classList.contains('is-active')) {
                        const ul = e.target.parentElement
                        ul.querySelector('.is-active').classList.remove('is-active')
                        e.target.classList.add('is-active')
	                    if(ul.id === 'categoryList') {
                            params.categoryName = e.target.getAttribute('value')
	                    } else {
                            // params['nation'] = e.target.getAttribute('value')
                            nationName = e.target.innerText !== 'All' && e.target.innerText
	                    }

                        let url = '/instagram/rank'
	                    if (params.categoryName) {
                            url += '-' + params.categoryName
	                    }
	                    url += '-influencers'
	                    if(nationName) {
	                        url += '-' + nationName
	                    }
                        window.location.href = url
                    }
                })
            })
            document.querySelectorAll('.filter-wrap__inner li').forEach(item => {
                item.addEventListener('click', e => {
                    if(!e.target.classList.contains('is-active')) {
                        const ul = e.target.parentElement
                        // ul.querySelector('.is-active').classList.remove('is-active')
                        e.target.classList.add('is-active')
                        if(ul.id === 'sortCategory') {
                            params.categoryName = e.target.getAttribute('value')
                        } else {
                            params.nation = e.target.getAttribute('value')
                            nationName = e.target.innerText
                        }

                        let url = '/instagram/rank'
                        if (params.categoryName) {
                            url += '-' + params.categoryName
                        }
                        url += '-influencers'
                        if(nationName) {
                            url += '-' + nationName
                        }
                        window.location.href = url
                    }
                })
            })
        }).catch(err => {
            console.err(err)
        })
    }

    function getCategory() {
        return _axios.get('/ins/dic/overall/category')
    }

    function getCountry() {
        let url = getEncodeUrl('/ins/dic/region', {
            type: 1
        })
        return _axios.get(url)
    }
</script>
<script type="module">
    import '/static/js/list/common.js'

    const upgradeEle = document.querySelector('tfoot .text-link')
    upgradeEle && upgradeEle.addEventListener('click', () => {
        window.location.href = '/pricing?refer=' + window.location.href
    })
</script>
</body>
</html>